package subject_set.newcoder;

/**
 * @author haomin
 * @date 2023/01/22 21:27
 **/
public class NC25 {
    public class Solution {
        /**
         *
         * @param head ListNode类
         * @return ListNode类
         */
        public ListNode deleteDuplicates (ListNode head) {
            // write code here
            ListNode cur = head;
            while(cur != null) {
                while(cur.next != null && cur.val == cur.next.val) {
                    cur.next = cur.next.next;
                }
                cur = cur.next;
            }
            return head;
        }
    }
}